import {configService} from './config.service'

config: Config;

showConfig() {
    this.configService.getConfig()
    // clone the data object, using its known Config shape
        .subscribe(data => this.config = {
            heroesUrl: (data as any).heroesUrl,
            textfile:  (data as any).textfile,
            console.log(data)
        });
}
getConfig() {
    // now returns an Observable of Config
    return this.http.get<Config>(this.configUrl);
}
showConfigResponse() {
    this.configService.getConfigResponse()
    // resp is of type `HttpResponse<Config>`
        .subscribe(resp => {
            // display its headers
            const keys = resp.headers.keys();
            this.headers = keys.map(key =>
                `${key}: ${resp.headers.get(key)}`);

            // access the body directly, which is typed as `Config`.
            this.config = { ... resp.body };
        });
}
export interface Config {
    heroesUrl: string;
    textfile: string;
}

